#include <iostream>
#include <cstring>
#include <cstdio>
#include <string>
using namespace std;

int n, k, m;
int a[25];

int go(int p, int d, int t)
{
    while (t--)
    {
        do
        {
            p = (p + d + n - 1) % n + 1;
        } while (a[p] == 0);
    }
    return p;
}

int main()
{
    while (cin >> n >> k >> m && (n != 0))
    {
        for (int i = 1; i <= n; i++)
            a[i] = i;
        int left = n;
        int A = n, B = 1;
        while (left)
        {
            A = go(A, 1, k);
            B = go(B, -1, m);
            printf("%3d",A);
            left--;
            if (B != A)
            {
                printf("%3d",B);
                left--;
            }
            a[A] = a[B] = 0;
            if (left)
                cout << ",";
        }
        cout<<"\n";
    }

    return 0;
}